package com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile;

import com.beerandjesus.sportofkings.handicapper.model.*;

import java.util.List;

public class HorseImpl extends BaseHorseImpl implements Horse {

    private String programNumber;
    private String entry;
    private String morningLineOdds;
    private String currentStudFee;
    private String color;
    private String weight;
    private String mainTrackOnlyOrAE;
    private String postPosition;
    // Post position after early scratches
    private String programPostPos;
    private Medication medication;
    private EquipmentChange equipmentChange;
    private String brisRunStyle;
    private String quirinSpeedPoints;
    private String daysSinceLastRace;
    private String lifeStartsAllWeather;
    private String lifeWinsAllWeather;
    private String lifePlaceAllWeather;
    private String lifeShowAllWeather;
    private String lifeEarningsAllWeather;
    private String bestBrisSpeedAllWeather;
    private String primePowerRating;
    private String bestBrisSpeedLife;
    private String bestBrisSpeedRecentYear;
    private String bestBrisSpeed2ndRecentYear;
    private String bestBrisSpeedThisTrack;
    private String numStartsDirt;
    private String numWinsDirt;
    private String numPlacesDirt;
    private String numShowsDirt;
    private String earningsDirt;
    private Pedigree pedigree;
    private PerformanceRecord performanceRecord;
    private List<Workout> workouts;
    private List<PastPerformance> pastPerformances;
    private TrainerJockeyOwner trainerJockeyOwner;

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getProgramNumber()
     */
    public String getProgramNumber() {
        return programNumber;
    }

    public void setProgramNumber(String programNumber) {
        this.programNumber = programNumber;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getEntry()
     */
    public String getEntry() {
        return entry;
    }

    public void setEntry(String entry) {
        this.entry = entry;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getMorningLineOdds()
     */
    public String getMorningLineOdds() {
        return morningLineOdds;
    }

    public void setMorningLineOdds(String morningLineOdds) {
        this.morningLineOdds = morningLineOdds;
    }

    public boolean isFirstOrSecondTimeStarter() {
        return getPastPerformances() == null || getPastPerformances().size() < 2;
    }

    public boolean isFirstTimeStarter() {
        return getPastPerformances() == null || getPastPerformances().size() == 0;
    }

    public boolean hasMeasurableTurfPedigreeRating() {
        return getPedigree() != null && getPedigree().getTurfPedigreeRating() != null
                && getPedigree().getDirtPedigreeRating() != null
                && !ratingsAreFromVerySmallSamples(getPedigree().getTurfPedigreeRating(), getPedigree().getDirtPedigreeRating());
    }

    private boolean ratingsAreFromVerySmallSamples(String rating1, String rating2) {
        return rating1.contains("*") || rating2.contains("*");
    }

    public boolean hasMeasurableDirtDistancePedigreeRating() {
        return getPedigree() != null && getPedigree().getDistancePedigreeRating() != null
                && getPedigree().getDirtPedigreeRating() != null;
    }

    public int getNumberOfStarts() {
        int num = 0;
        if (getPastPerformances() != null) {
            num = getPastPerformances().size();
        }
        return num;
    }

    public String getCurrentStudFee() {
        return currentStudFee;
    }

    public void setCurrentStudFee(String currentStudFee) {
        this.currentStudFee = currentStudFee;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getColor()
     */
    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getWeight()
     */
    public String getWeight() {
        return weight;
    }

    public void setWeight(String weight) {
        this.weight = weight;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getMainTrackOnlyOrAE()
     */
    public String getMainTrackOnlyOrAE() {
        return mainTrackOnlyOrAE;
    }

    public void setMainTrackOnlyOrAE(String mainTrackOnlyOrAE) {
        this.mainTrackOnlyOrAE = mainTrackOnlyOrAE;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getPostPosition()
     */
    public String getPostPosition() {
        return postPosition;
    }

    public void setPostPosition(String postPosition) {
        this.postPosition = postPosition;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getProgramPostPos()
     */
    public String getProgramPostPosition() {
        return programPostPos;
    }

    public void setProgramPostPosition(String programPostPos) {
        this.programPostPos = programPostPos;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getMedication()
     */
    public Medication getMedication() {
        return medication;
    }

    public void setMedication(Medication medication) {
        this.medication = medication;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getEquipmentChange()
     */
    public EquipmentChange getEquipmentChange() {
        return equipmentChange;
    }

    public void setEquipmentChange(EquipmentChange equipmentChange) {
        this.equipmentChange = equipmentChange;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getBrisRunStyle()
     */
    public String getBrisRunStyle() {
        return brisRunStyle;
    }

    public void setBrisRunStyle(String brisRunStyle) {
        this.brisRunStyle = brisRunStyle;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getQuirinSpeedPoints()
     */
    public String getQuirinSpeedPoints() {
        return quirinSpeedPoints;
    }

    public void setQuirinSpeedPoints(String quirinSpeedPoints) {
        this.quirinSpeedPoints = quirinSpeedPoints;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getDaysSinceLastRace()
     */
    public String getDaysSinceLastRace() {
        return daysSinceLastRace;
    }

    public void setDaysSinceLastRace(String daysSinceLastRace) {
        this.daysSinceLastRace = daysSinceLastRace;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getLifeStartsAllWeather()
     */
    public String getLifeStartsAllWeather() {
        return lifeStartsAllWeather;
    }

    public void setLifeStartsAllWeather(String lifeStartsAllWeather) {
        this.lifeStartsAllWeather = lifeStartsAllWeather;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getLifeWinsAllWeather()
     */
    public String getLifeWinsAllWeather() {
        return lifeWinsAllWeather;
    }

    public void setLifeWinsAllWeather(String lifeWinsAllWeather) {
        this.lifeWinsAllWeather = lifeWinsAllWeather;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getLifePlaceAllWeather()
     */
    public String getLifePlaceAllWeather() {
        return lifePlaceAllWeather;
    }

    public void setLifePlaceAllWeather(String lifePlaceAllWeather) {
        this.lifePlaceAllWeather = lifePlaceAllWeather;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getLifeShowAllWeather()
     */
    public String getLifeShowAllWeather() {
        return lifeShowAllWeather;
    }

    public void setLifeShowAllWeather(String lifeShowAllWeather) {
        this.lifeShowAllWeather = lifeShowAllWeather;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getLifeEarningsAllWeather()
     */
    public String getLifeEarningsAllWeather() {
        return lifeEarningsAllWeather;
    }

    public void setLifeEarningsAllWeather(String lifeEarningsAllWeather) {
        this.lifeEarningsAllWeather = lifeEarningsAllWeather;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getBestBrisSpeedAllWeather()
     */
    public String getBestBrisSpeedAllWeather() {
        return bestBrisSpeedAllWeather;
    }

    public void setBestBrisSpeedAllWeather(String bestBrisSpeedAllWeather) {
        this.bestBrisSpeedAllWeather = bestBrisSpeedAllWeather;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getPrimePowerRating()
     */
    public String getPrimePowerRating() {
        return primePowerRating;
    }

    public void setPrimePowerRating(String primePowerRating) {
        this.primePowerRating = primePowerRating;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getBestBrisSpeedLife()
     */
    public String getBestBrisSpeedLife() {
        return bestBrisSpeedLife;
    }

    public void setBestBrisSpeedLife(String bestBrisSpeedLife) {
        this.bestBrisSpeedLife = bestBrisSpeedLife;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getBestBrisSpeedRecentYear()
     */
    public String getBestBrisSpeedRecentYear() {
        return bestBrisSpeedRecentYear;
    }

    public void setBestBrisSpeedRecentYear(String bestBrisSpeedRecentYear) {
        this.bestBrisSpeedRecentYear = bestBrisSpeedRecentYear;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getBestBrisSpeed2ndRecentYear()
     */
    public String getBestBrisSpeed2ndRecentYear() {
        return bestBrisSpeed2ndRecentYear;
    }

    public void setBestBrisSpeed2ndRecentYear(String bestBrisSpeed2ndRecentYear) {
        this.bestBrisSpeed2ndRecentYear = bestBrisSpeed2ndRecentYear;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getBestBrisSpeedThisTrack()
     */
    public String getBestBrisSpeedThisTrack() {
        return bestBrisSpeedThisTrack;
    }

    public void setBestBrisSpeedThisTrack(String bestBrisSpeedThisTrack) {
        this.bestBrisSpeedThisTrack = bestBrisSpeedThisTrack;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getNumStartsDirt()
     */
    public String getNumStartsDirt() {
        return numStartsDirt;
    }

    public void setNumStartsDirt(String numStartsDirt) {
        this.numStartsDirt = numStartsDirt;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getNumWinsDirt()
     */
    public String getNumWinsDirt() {
        return numWinsDirt;
    }

    public void setNumWinsDirt(String numWinsDirt) {
        this.numWinsDirt = numWinsDirt;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getNumPlacesDirt()
     */
    public String getNumPlacesDirt() {
        return numPlacesDirt;
    }

    public void setNumPlacesDirt(String numPlacesDirt) {
        this.numPlacesDirt = numPlacesDirt;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getNumShowssDirt()
     */
    public String getNumShowsDirt() {
        return numShowsDirt;
    }

    public void setNumShowsDirt(String numShowssDirt) {
        this.numShowsDirt = numShowssDirt;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getEarningsDirt()
     */
    public String getEarningsDirt() {
        return earningsDirt;
    }

    public void setEarningsDirt(String earningsDirt) {
        this.earningsDirt = earningsDirt;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getPedigree()
     */
    public Pedigree getPedigree() {
        return pedigree;
    }

    public void setPedigree(Pedigree pedigree) {
        this.pedigree = pedigree;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getPerformanceRecord()
     */
    public PerformanceRecord getPerformanceRecord() {
        return performanceRecord;
    }

    public void setPerformanceRecord(PerformanceRecord performanceRecord) {
        this.performanceRecord = performanceRecord;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getWorkouts()
     */
    public List<Workout> getWorkouts() {
        return workouts;
    }

    public void setWorkouts(List<Workout> workouts) {
        this.workouts = workouts;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getPastPerformances()
     */
    public List<PastPerformance> getPastPerformances() {
        return pastPerformances;
    }

    public void setPastPerformances(List<PastPerformance> pastPerformances) {
        this.pastPerformances = pastPerformances;
    }

    /* (non-Javadoc)
     * @see com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse#getTrainerJockeyOwner()
     */
    public TrainerJockeyOwner getTrainerJockeyOwner() {
        return trainerJockeyOwner;
    }

    public void setTrainerJockeyOwner(TrainerJockeyOwner trainerJockeyOwner) {
        this.trainerJockeyOwner = trainerJockeyOwner;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof HorseImpl)) return false;
        if (!super.equals(o)) return false;

        HorseImpl horse = (HorseImpl) o;

        if (bestBrisSpeed2ndRecentYear != null ? !bestBrisSpeed2ndRecentYear.equals(horse.bestBrisSpeed2ndRecentYear) : horse.bestBrisSpeed2ndRecentYear != null)
            return false;
        if (bestBrisSpeedAllWeather != null ? !bestBrisSpeedAllWeather.equals(horse.bestBrisSpeedAllWeather) : horse.bestBrisSpeedAllWeather != null)
            return false;
        if (bestBrisSpeedLife != null ? !bestBrisSpeedLife.equals(horse.bestBrisSpeedLife) : horse.bestBrisSpeedLife != null)
            return false;
        if (bestBrisSpeedRecentYear != null ? !bestBrisSpeedRecentYear.equals(horse.bestBrisSpeedRecentYear) : horse.bestBrisSpeedRecentYear != null)
            return false;
        if (bestBrisSpeedThisTrack != null ? !bestBrisSpeedThisTrack.equals(horse.bestBrisSpeedThisTrack) : horse.bestBrisSpeedThisTrack != null)
            return false;
        if (brisRunStyle != null ? !brisRunStyle.equals(horse.brisRunStyle) : horse.brisRunStyle != null) return false;
        if (color != null ? !color.equals(horse.color) : horse.color != null) return false;
        if (currentStudFee != null ? !currentStudFee.equals(horse.currentStudFee) : horse.currentStudFee != null)
            return false;
        if (daysSinceLastRace != null ? !daysSinceLastRace.equals(horse.daysSinceLastRace) : horse.daysSinceLastRace != null)
            return false;
        if (earningsDirt != null ? !earningsDirt.equals(horse.earningsDirt) : horse.earningsDirt != null) return false;
        if (entry != null ? !entry.equals(horse.entry) : horse.entry != null) return false;
        if (equipmentChange != horse.equipmentChange) return false;
        if (lifeEarningsAllWeather != null ? !lifeEarningsAllWeather.equals(horse.lifeEarningsAllWeather) : horse.lifeEarningsAllWeather != null)
            return false;
        if (lifePlaceAllWeather != null ? !lifePlaceAllWeather.equals(horse.lifePlaceAllWeather) : horse.lifePlaceAllWeather != null)
            return false;
        if (lifeShowAllWeather != null ? !lifeShowAllWeather.equals(horse.lifeShowAllWeather) : horse.lifeShowAllWeather != null)
            return false;
        if (lifeStartsAllWeather != null ? !lifeStartsAllWeather.equals(horse.lifeStartsAllWeather) : horse.lifeStartsAllWeather != null)
            return false;
        if (lifeWinsAllWeather != null ? !lifeWinsAllWeather.equals(horse.lifeWinsAllWeather) : horse.lifeWinsAllWeather != null)
            return false;
        if (mainTrackOnlyOrAE != null ? !mainTrackOnlyOrAE.equals(horse.mainTrackOnlyOrAE) : horse.mainTrackOnlyOrAE != null)
            return false;
        if (medication != horse.medication) return false;
        if (morningLineOdds != null ? !morningLineOdds.equals(horse.morningLineOdds) : horse.morningLineOdds != null)
            return false;
        if (numPlacesDirt != null ? !numPlacesDirt.equals(horse.numPlacesDirt) : horse.numPlacesDirt != null)
            return false;
        if (numShowsDirt != null ? !numShowsDirt.equals(horse.numShowsDirt) : horse.numShowsDirt != null) return false;
        if (numStartsDirt != null ? !numStartsDirt.equals(horse.numStartsDirt) : horse.numStartsDirt != null)
            return false;
        if (numWinsDirt != null ? !numWinsDirt.equals(horse.numWinsDirt) : horse.numWinsDirt != null) return false;
        if (pastPerformances != null ? !pastPerformances.equals(horse.pastPerformances) : horse.pastPerformances != null)
            return false;
        if (pedigree != null ? !pedigree.equals(horse.pedigree) : horse.pedigree != null) return false;
        if (performanceRecord != null ? !performanceRecord.equals(horse.performanceRecord) : horse.performanceRecord != null)
            return false;
        if (postPosition != null ? !postPosition.equals(horse.postPosition) : horse.postPosition != null) return false;
        if (primePowerRating != null ? !primePowerRating.equals(horse.primePowerRating) : horse.primePowerRating != null)
            return false;
        if (programNumber != null ? !programNumber.equals(horse.programNumber) : horse.programNumber != null)
            return false;
        if (programPostPos != null ? !programPostPos.equals(horse.programPostPos) : horse.programPostPos != null)
            return false;
        if (quirinSpeedPoints != null ? !quirinSpeedPoints.equals(horse.quirinSpeedPoints) : horse.quirinSpeedPoints != null)
            return false;
        if (trainerJockeyOwner != null ? !trainerJockeyOwner.equals(horse.trainerJockeyOwner) : horse.trainerJockeyOwner != null)
            return false;
        if (weight != null ? !weight.equals(horse.weight) : horse.weight != null) return false;
        if (workouts != null ? !workouts.equals(horse.workouts) : horse.workouts != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + (programNumber != null ? programNumber.hashCode() : 0);
        result = 31 * result + (entry != null ? entry.hashCode() : 0);
        result = 31 * result + (morningLineOdds != null ? morningLineOdds.hashCode() : 0);
        result = 31 * result + (currentStudFee != null ? currentStudFee.hashCode() : 0);
        result = 31 * result + (color != null ? color.hashCode() : 0);
        result = 31 * result + (weight != null ? weight.hashCode() : 0);
        result = 31 * result + (mainTrackOnlyOrAE != null ? mainTrackOnlyOrAE.hashCode() : 0);
        result = 31 * result + (postPosition != null ? postPosition.hashCode() : 0);
        result = 31 * result + (programPostPos != null ? programPostPos.hashCode() : 0);
        result = 31 * result + (medication != null ? medication.hashCode() : 0);
        result = 31 * result + (equipmentChange != null ? equipmentChange.hashCode() : 0);
        result = 31 * result + (brisRunStyle != null ? brisRunStyle.hashCode() : 0);
        result = 31 * result + (quirinSpeedPoints != null ? quirinSpeedPoints.hashCode() : 0);
        result = 31 * result + (daysSinceLastRace != null ? daysSinceLastRace.hashCode() : 0);
        result = 31 * result + (lifeStartsAllWeather != null ? lifeStartsAllWeather.hashCode() : 0);
        result = 31 * result + (lifeWinsAllWeather != null ? lifeWinsAllWeather.hashCode() : 0);
        result = 31 * result + (lifePlaceAllWeather != null ? lifePlaceAllWeather.hashCode() : 0);
        result = 31 * result + (lifeShowAllWeather != null ? lifeShowAllWeather.hashCode() : 0);
        result = 31 * result + (lifeEarningsAllWeather != null ? lifeEarningsAllWeather.hashCode() : 0);
        result = 31 * result + (bestBrisSpeedAllWeather != null ? bestBrisSpeedAllWeather.hashCode() : 0);
        result = 31 * result + (primePowerRating != null ? primePowerRating.hashCode() : 0);
        result = 31 * result + (bestBrisSpeedLife != null ? bestBrisSpeedLife.hashCode() : 0);
        result = 31 * result + (bestBrisSpeedRecentYear != null ? bestBrisSpeedRecentYear.hashCode() : 0);
        result = 31 * result + (bestBrisSpeed2ndRecentYear != null ? bestBrisSpeed2ndRecentYear.hashCode() : 0);
        result = 31 * result + (bestBrisSpeedThisTrack != null ? bestBrisSpeedThisTrack.hashCode() : 0);
        result = 31 * result + (numStartsDirt != null ? numStartsDirt.hashCode() : 0);
        result = 31 * result + (numWinsDirt != null ? numWinsDirt.hashCode() : 0);
        result = 31 * result + (numPlacesDirt != null ? numPlacesDirt.hashCode() : 0);
        result = 31 * result + (numShowsDirt != null ? numShowsDirt.hashCode() : 0);
        result = 31 * result + (earningsDirt != null ? earningsDirt.hashCode() : 0);
        result = 31 * result + (pedigree != null ? pedigree.hashCode() : 0);
        result = 31 * result + (performanceRecord != null ? performanceRecord.hashCode() : 0);
        result = 31 * result + (workouts != null ? workouts.hashCode() : 0);
        result = 31 * result + (pastPerformances != null ? pastPerformances.hashCode() : 0);
        result = 31 * result + (trainerJockeyOwner != null ? trainerJockeyOwner.hashCode() : 0);
        return result;
    }
}
